<template>
  <div id="app">
    <v-header :seller = "seller"></v-header>
    <div class="tab border-1px">
      <div class="tab-item">
        <router-link to="/goods">商品</router-link>
      </div>
      <div class="tab-item">
        <router-link to="/ratings">评价</router-link>
      </div>
      <div class="tab-item">
        <router-link to="/seller">商家</router-link>
      </div>
    </div>
    <keep-alive><router-view :seller="seller"></router-view></keep-alive>
  </div>
</template>

<script>
import vheader from 'components/header/header';
const axios = require('axios');
const ERR_OK = 0;
export default {
  name: 'app',
  components: {
    'v-header': vheader
  },
  data () {
    return {
      seller: {}
    };
  },
  created () {
    const _this = this;
    axios.get('/api/seller')
      .then(function (response) {
        if (response.data.status === ERR_OK) {
          _this.seller = response.data.data;
        }
      });
  }
};
</script>

<style lang="stylus" scoped="scoped">
@import 'common/stylus/mixin.styl';
@import 'common/stylus/base.styl';
.tab
  display: flex
  height: 40px
  line-height: 40px
  text-align: center
  border-bottom-1px(rgba(7, 17, 27, 0.1))
  .tab-item
    flex: 1
    & > a
      display: inline-block
      width: 100%
      font-size: 14px
      color: rgb(77, 85, 93)
      &.router-link-active
        color: rgb(240, 20, 20)
</style>
